<include file="Public:header_content" />
<div class="ibox-content">
        <div class="form-group">
            <label for="exampleInputEmail2">URL地址：</label>
            <input type="text" name="url" placeholder="请输入URL地址"  class="form-control">
        </div>
        <button class="btn btn-white" id="add-url-form" type="submit">保存</button>
</div>
<script>
$(function(){
        var e="<i class='fa fa-times-circle'></i> ";
        $("#add-url-form").validate({
            rules:{
                url:{required:!0,url:true}
            },
            messages:{
                url:{
                    required:e+"请输入URL地址",
                    url:e+"输入的链接地址有误"
                }
            }
        });

        $('#add-url-form').click(function(){
            var url = $('input[name="url"]').val();
            $.ajax({
               type: "POST",
               url: "__SELF__",
               data: "url="+url,
               success: function(msg){
                    if(msg){
                        parent.$('#alwei-img').attr('src',msg);
                        parent.$('input[name="img"]').val(msg);
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    }
                }
            });

        });

    });
</script>
<include file="Public:footer_content" />
